import request from '@/utils/request'

// 获取订单
export const getOrderList = (params: any) => {
  return request
    .get('/orders', {
      params,
    })
    .then((res: any) => {
      return res
    })
}

// 创建订单
export const createOrder = (params: any) => {
  return request.post('/orders/', params).then((res: any) => {
    return res
  })
}

// 更新订单
export const updateOrder = (id: number, params: any) => {
  return request
    .put(`/orders/${id}`, {
      action: params.Status,
    })
    .then((res: any) => {
      return res
    })
}

// 删除订单
export const deleteOrderById = (id: number) => {
  return request.delete(`/orders/${id}`).then((res: any) => {
    return res
  })
}

// 批量删除订单
export const deleteOrderByIdList = (data: any) => {
  return request.delete(`/orders/dl`, { data }).then((res: any) => {
    return res
  })
}

// 查看当个订单详细
export const getOrderById = (id: number) => {
  return request.get(`/orders/${id}`).then((res: any) => {
    return res
  })
}
